
"""
计算1+2+...+100
"""
sum = 0
i = 1
while i <= 100:
    sum = sum + i
    i += 1
print(f'1+2+...+100={sum}')

"""
计算 偶数 2+4+6+...+100
"""
a = 1
result = 0

while a <= 100:
    if a % 2 == 0:
        result = result + a
    a += 1
print(f'2+4+6+...+100={result}')

"""
计算 奇数 1+3+5+...+99
"""

result1 = 0
b = 1
while b <= 100:
    if b % 2 == 1:
        result1 += b
    b += 1
print(f'1+3+5+...+99={result1}')

